/**
 * @file TcpServer.hh
 * @author zziywang (zziywang@163.com)
 * @brief { life is too short to learn cpp! }
 * @version 1.0
 * @date 2022-05-08
 *
 * @copyright Copyright (c) 2022
 *
 */

#pragma once

#include "Acceptor.hh"
#include "EventLoop.hh"

namespace snow
{

class TcpServer
{
public:
    TcpServer(const string &ip, unsigned short port);
    explicit TcpServer(unsigned short port);
    TcpServer(const struct sockaddr_in addr);

    void start();
    
    void setConnectionCallBack(const TcpConnectionCallBack &cb);
    void setMessageCallBack(const TcpConnectionCallBack &cb);
    void setCloseCallBack(const TcpConnectionCallBack &cb);

private:
    Acceptor acceptor_;
    EventLoop eventLoop_;
};

} // namespace snow